<?php
	defined('_JEXEC') or  die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
	/* Load  VM function */
	require('helper.php');
	JTable::addIncludePath(JPATH_VM_ADMINISTRATOR.DS.'tables');
	vmJsApi::jQuery();
	vmJsApi::cssSite();
	/* Setting */
	$categoryModel = VmModel::getModel('Category');
	$category_id = loadPreferredCategory();//$params->get('Parent_Category_id', 0);
	$class_sfx = $params->get('class_sfx', '');
	$moduleclass_sfx = $params->get('moduleclass_sfx','');
	$layout = $params->get('layout','default');
	$active_category_id = JRequest::getInt('virtuemart_category_id', '0');
	$vendorId = '1';
	$cache = & JFactory::getCache('com_virtuemart','callback');
	$categories = $cache->call( array( 'VirtueMartModelCategory', 'getChildCategoryList' ),$vendorId, $category_id );
	if(empty($categories)) return false;
	foreach ($categories as $category) {
		$category->childs = $cache->call( array( 'VirtueMartModelCategory', 'getChildCategoryList' ),$vendorId, $category->virtuemart_category_id );
	}
	$parentCategories = $categoryModel->getCategoryRecurse($active_category_id,0);
	/* Laod tmpl default */
	require(JModuleHelper::getLayoutPath('mod_virtuemart_category',$layout));
?>